package com.nancy.java_design.mediator.demo1;

/**
 * 具体的中介者
 */
public class MediatorStructure implements Mediator {
    private Tenant tenant;
    private HomeOwner homeOwner;

    public HomeOwner getHomeOwner() {
        return homeOwner;
    }

    public void setHomeOwner(HomeOwner homeOwner) {
        this.homeOwner = homeOwner;
    }

    public Tenant getTenant() {
        return tenant;
    }

    public void setTenant(Tenant tenant) {
        this.tenant = tenant;
    }

    @Override
    public void send(String message, Colleague colleague) {
        if (colleague == tenant) {
            System.out.println("租户收到信息：" + message);
        } else {
            System.out.println("房主收到信息：" + message);
        }
    }
}
